<?php
/**
 * Created by PhpStorm.
 * User: hooshim
 * Date: 2014-12-03
 * Time: 오전 11:23
 */

header("Content-Type:text/html;charset=utf-8");
header("Cache-Control:no-cache");
header("Pragma:no-cache");

include_once ($_SERVER['DOCUMENT_ROOT']."/inc/conn.inc.php");
include_once ($_SERVER['DOCUMENT_ROOT']."/inc/function.inc.php"); ##property 파일 인크루드됨.

	//## 파라미터 선언
    $findCompany 			= $_POST['findCompany'];

	// Table 이름 선언
	$tbname = "tblCompany";

    $curDt =date("Y-m-d");
    if (!$findCompany) $limit = "TOP 100";
    else $limit = "";
    $query = "SELECT {$limit} companyKR, owner, phone, fax, major, cellPhone, majorPhone, companyEN, compNo, ";
    $query .= " CASE WHEN flag='Y' THEN '거래중' ELSE '정지' END AS flag, compCd as link ";
    $query .= " FROM {$tbname} WHERE companyKR IS NOT NULL";
    if ($findCompany) $query .= " AND (companyKR LIKE '%{$findCompany}%' OR companyEN LIKE '%{$findCompany}%')";
    $query .= " ORDER BY companyKR";
    $query = iconvEncode($query);

    $logger->debug($query ."<br>[#FROM:" . $G_remote_ip."#]"); ## 쿼리 로그 작성
    $result = makeJSONArray($query,"GRIDDATA");

    $output = json_encode($result);
    $output = urldecode($output);
    echo iconvDecode($output);
    $logger->debug($_SESSION['BID'] ."//" .$output ."<br>[#FROM:" . $G_remote_ip."#]"); ## 결과 로그 작성
?>